POV-Ray : Newsgroups : povray.general : possible #switch error : Re: possible #switch error Server Time
30 Jul 2024 04:24:27 EDT (-0400)
  Re: possible #switch error  
From: Brickman Brick
Date: 12 Nov 2009 07:27:08
Message: <4afbff1c@news.povray.org>
Hello,


Op Wed, 11 Nov 2009 14:11:01 +0000, schreef Chris B:

> I use and abuse the switch statement quite a lot and I've not found any
> problems with it, so I suspect that you're doing something wrong, though
> you haven't provided enough info to really be sure of that.
>

Thank you for your help. I will try to provide more info. The code reads a
text file with integers. These integers are passed to the #switch
statement. In each #switch clause a macro is called to place an object 
and modify two other variables. One of these variables got corrupted. So 
I may be completely wrong with blaming the #switch statement for the 
error in the first place.

> My first suspect would be the calculated variable. Are you sure it
> definitely results in an integer value that will match one of the #case
> statements?

When the data is read from a file it is read as floats. So a converion to
integers wouldn't be a bad idea?

> Otherwise I think you'll need to find out the exact circumstances that
> causes it to break (using strategically placed debug statements), or at
> least provide a cut-down, but complete example that would enable someone
> else to replicate the problem. If it only fails 1 in 1000 times then
> provide an example with a loop that's large enough to consistently fail.

When I try to find the exact place where the code breaks, e.g. with a
#debug statement. The code suddenly doesn't break anymore. When I remove 
the #debug the code is broken again.
This is the frustrating part, when I try to provide a cut-down working
example the code suddenly works again. So it is very hard to find the bug.

> This sounds quite odd. When you have explored all other possible causes.
> it may be worth considering that the file or that your installation may
> be corrupt in some way. I have occasionally had wierd things happen
> where simply deleting and manually rekeying lines have cured the
> problem. I've rationalised this by believing that I may have
> accidentally typed an invisible hex character into the file that's
> corrupted it, or that it's somehow been corrupted by a disk read or
> write error. If you think the application may have gotten corrupted,
> then you may want to consider reinstalling it. I'd wait for a bit before
> exploring these more radical ideas though as someone else might come up
> with other ideas.

I already eliminated the possibility that my povray installation is
corrupt. I copied the data to a virual machine (running another os) and
encountered the same error. 
Could it be some hardware failure? Today, e.g. I am unable to reproduce 
the error (even in the virtual machine). But I think it will show up 
again in the future.

Brickman Brick


-- 
brickcentral.livejournal.com


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.